from datetime import datetime
from  exts import db
from apps.common.base_model import BaseModel

class Address(BaseModel):
    __tablename__="t_address"
    a_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    province = db.Column(db.String(50),unique=True,nullable=False,comment="省份")
    city = db.Column(db.String(50),unique=True,nullable=True,comment="城市")
    district = db.Column(db.String(50),unique=True,nullable=True,comment="区域")
    address = db.Column(db.String(100),unique=True,nullable=True, comment="详细地址")
    contact_name = db.Column(db.String(20),unique=True,nullable=True,  comment="联系人")
    contact_mobile = db.Column(db.String(11),unique=True,nullable=True,  comment="联系电话")
    user_id=db.Column(db.Integer,db.ForeignKey("t_member.id"))
    # user_id = db.Column(db.Integer)
    # user = models.ForeignKey(MyUser, verbose_name="用户" ,on_delete=models.DO_NOTHING)
    is_default=db.Column(db.Integer,default=0,comment="是否默认配送地址")
    # create_date = db.Column(db.DateTime,default=datetime.now, comment="创建时间")

    def __repr__(self):
        return self.province+self.city+self.district+self.address